package service.auth.impl;

import java.util.List;
import java.util.Map;

import model.auth.Authorities;
import model.auth.Roles;
import model.auth.RolesAuthorities;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import service.auth.RolesAuthoritiesService;
import core.base.page.Page;
import core.base.page.PageRequest;
import dao.auth.RolesAuthoritiesDao;

@Service("auth.RolesAuthoritiesService")
public class RolesAuthoritiesServiceImpl implements RolesAuthoritiesService {

	@Autowired
	@Qualifier("auth.RolesAuthoritiesDao")
	private RolesAuthoritiesDao rolesAuthoritiesDao;

	public int deleteById(Long id) {
		return rolesAuthoritiesDao.deleteById(id);
	}

	public RolesAuthorities getById(Long id) {
		return rolesAuthoritiesDao.getById(id);
	}

	public void insert(RolesAuthorities model) {
		rolesAuthoritiesDao.insert(model);
	}

	public List<Authorities> getAuthoritiesByRoleId(Long roleId) {
		return rolesAuthoritiesDao.getAuthoritiesByRoleId(roleId);
	}

	public List<Roles> getRolesByAuthCode(String authCode) {
		return rolesAuthoritiesDao.getRolesByAuthCode(authCode);
	}

	public Page<Authorities> queryAuthoritiesForPage(PageRequest<Map> pageReq) {
		return rolesAuthoritiesDao.queryAuthoritiesForPage(pageReq);
	}

	public Page<Roles> queryRolesForPage(PageRequest<Map> pageReq) {
		return rolesAuthoritiesDao.queryRolesForPage(pageReq);
	}

	public void setRolesAuthoritiesDao(RolesAuthoritiesDao rolesAuthoritiesDao) {
		this.rolesAuthoritiesDao = rolesAuthoritiesDao;
	}

}
